using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using TodoLister.Models;

namespace TodoLister.Converters
{
    /// <summary>
    /// 优先级颜色转换器
    /// </summary>
    public class PriorityToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is TodoPriority priority)
            {
                switch (priority)
                {
                    case TodoPriority.High:
                        return new SolidColorBrush(Color.FromRgb(255, 69, 58));    // 红色
                    case TodoPriority.Medium:
                        return new SolidColorBrush(Color.FromRgb(255, 159, 10));   // 橙色
                    case TodoPriority.Low:
                        return new SolidColorBrush(Color.FromRgb(48, 209, 88));    // 绿色
                    default:
                        return new SolidColorBrush(Color.FromRgb(142, 142, 147));  // 灰色
                }
            }
            return new SolidColorBrush(Color.FromRgb(142, 142, 147));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
} 